package com.ddwl.user.controller;

import com.ddwl.common.annotation.Auth;
import com.ddwl.common.controller.BaseController;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.user.CaptchaVo;
import com.ddwl.user.service.CaptchaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Fu Zhaohui
 */
@Api(tags = "图形验证码")
@RequestMapping("/captcha")
@RestController
@RequiredArgsConstructor
public class CaptchaController extends BaseController {

    private final CaptchaService captchaService;

    @GetMapping("/code")
    @Auth(required = false)
    @ApiOperation("获取验证码")
    public RestVo<CaptchaVo> getCode() {
        return RestVo.ok(captchaService.getCode());
    }
}
